#ifndef BOARD_H
#define BOARD_H

#include<QWidget>
#include"Stone.h"

class Board : public QWidget
{
    Q_OBJECT
public:
    explicit Board(QWidget *parent = nullptr);

    Stone _s[32];

    int _r;
    int _selectid;
    bool _bRedTurn;

    QPoint center(int row,int col);
    QPoint center(int id);
    bool getRowCol(QPoint pt,int& row,int& col);

    void drawStone(QPainter& painter ,int id);

    void paintEvent(QPaintEvent*);
    void mouseReleaseEvent(QMouseEvent*);

    bool canMove(int moveid,int row,int col,int killid);
    bool canMoveJIANG(int moveid,int row,int col,int killid);
    bool canMoveSHUAI(int moveid,int row,int col,int killid);
    bool canMoveSHI1(int moveid,int row,int col,int killid);
    bool canMoveSHI2(int moveid,int row,int col,int killid);
    bool canMoveXIANG1(int moveid,int row,int col,int killid);
    bool canMoveXIANG2(int moveid,int row,int col,int killid);
    bool canMoveMA(int moveid,int row,int col,int killid);
    bool canMoveCHE1(int moveid,int row,int col,int killid);
    bool canMoveCHE2(int moveid,int row,int col,int killid);
    bool canMovePAO1(int moveid,int row,int col,int killid);
    bool canMovePAO2(int moveid,int row,int col,int killid);
    bool canMoveZU(int moveid,int row,int col,int killid);
    bool canMoveBING(int moveid,int row,int col,int killid);

    bool isDead(int id);
    int getStoneId(int row,int col);
    int getStoneCountAtLine(int row1,int col1,int row2,int col2);

signals:
};

#endif // BOARD_H
